<?php
/**
 * Created by PhpStorm.
 * User: Dell
 * Date: 2018-12-25
 * Time: 14:02
 */

namespace app\admin\controller;


use app\common\model\OrderModel;

class Order extends Base
{
    //订单展示
    public function index(){
        if(request()->isAjax()){

            $param = input('param.');

            $limit = $param['pageSize'];
            $offset = ($param['pageNumber'] - 1) * $limit;

            $where = [];
            if (!empty($param['searchText'])) {
                $where['good_name'] = ['like', '%' . $param['searchText'] . '%'];
            }

            $order = new OrderModel();
            $selectResult = $order->getOrderByWhere($where, $offset, $limit);

            foreach($selectResult as $key=>$vo){
                $selectResult[$key]['orde_address'] = $vo['orde_city']." ".$vo['orde_address'];
            }

            $return['total'] = $order->getAllOrder($where);  // 总数据
            $return['rows'] = $selectResult;

            return json($return);
        }

        return $this->fetch();
    }

}